<?php

namespace app\common\model;

class Log extends BaseModel
{
    protected $type = [
        "start_time" => "timestamp",
        "end_time" => "timestamp",
        "pay_time" => "timestamp",
        "body" => "array"
    ];
    
    public function user()
    {
        return $this->belongsTo(User::class);
    }
    
    public function getStatusNameAttr($value,$data)
    {
        $temp = [
            -2 => "已失效",
            -1 => "待下单",
            1 => "待返佣",
            2 => "已返佣",
        ];
        return $temp[$data['status']] ?? '未知';
    }
}